|
|
|
|
|
|
|
The Many Faces of the Common Dialog |
|
|
|
|
|
|
|
|
One of the most commonly used functions of the Common Dialog control is the capability to select files to open or specify filenames to save. The Open and Save As dialog boxes allow users to specify a drive, directory, filename extension, and filename. If you've been using older versions of Visual Basic, you probably think that the code to display the Open dialog is the following: |
|
|
|
|
|
|
|
|
Although this code would still work, the preferred way of displaying any of the dialogs is by using one of the following methods of the control: |
|
|
|
 |
|
|
|
|
ShowOpen ShowColor
ShowSave ShowFont
ShowPrinter ShowHelp |
|
|
|
|
|
|
|
|
Using these methods makes the resulting code not only more precise, but also makes it very easy to understand. |
|
|
|
|
|
|
|
|
Because the Open and Save As dialog boxes perform very similar functions, this section covers them both. As mentioned earlier, the Open dialog box (see Figure 2.4) contains several different component types that work together. |
|
|
|
|
|
|
|
|
Figure 2.4.
The Open/Save As common dialog contains several
simpler controls used to interface with users. |
|
|
|
|
|
|
|
|
Among these components is the Toolbar control, which allows you to change the way file information is displayed, create new folders, and move up levels in the directory path. You also can use the drop-down box to select a drive or double-click a folder to move down a level in the directory path. |
|
|
|
|
|